// pages/book/book.js
Page({
  data: {
    images: [
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/0-中山梵英首页.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/1.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/2.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/3.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/4.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/5.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/6.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/7.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/8.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/9.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/10.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/11.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/12.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/13.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/14.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/15.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/16.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/17.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/18.jpg',
      'cloud://cloud1-7gexn9ti7088c614.636c-cloud1-7gexn9ti7088c614-1358457931/images/book_pages/中山梵英尾页.jpg'
    ],
    currentPage: 0
  },
  
  // 翻页动画
  pageChange(e:any) {
    this.setData({
      currentPage: e.detail.current
    });
  },
  
  // 上一页
  prevPage() {
    if (this.data.currentPage > 0) {
      this.setData({
        currentPage: this.data.currentPage - 1
      });
    }
  },
  
  // 下一页
  nextPage() {
    if (this.data.currentPage < this.data.images.length - 1) {
      this.setData({
        currentPage: this.data.currentPage + 1
      });
    }
  }
});
